class Solution {
    public int findNthDigit(int n) {
        int start = 1;
        long digist = 1, count = 9;
        while(n > count){
            n -= count;
            start *= 10;
            digist++;
            count = 9 * digist * start;
        }
        long num = start + (n - 1) / digist;
        return Long.toString(num).charAt((int) ((n - 1) % digist)) - '0';
    }
}